<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:beans="http://www.springframework.org/schema/beans"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:security="http://www.springframework.org/schema/security"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
						http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
						http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd">
	
	<!-- 루트 시큐리티 컨텍스트; 스프링 시큐리티를 설정한다. -->
	
	<!-- 스프링 시큐리티 보안 필터링을 위한 설정을 선언한다. -->
	<security:http auto-config="true">
		<security:form-login always-use-default-target="false"
			login-page="/security/login"
			login-processing-url="/login_process"
			authentication-failure-url="/security/login/failed"
			authentication-success-handler-ref="authenticationSuccessHandler"
			authentication-failure-handler-ref="authenticationFailureHandler" />
		<security:logout logout-url="/logout"/>
	</security:http>
	
	<beans:bean id="authenticationSuccessHandler" class="devcken.springframework.security.web.authentication.AuthenticationSuccessEventListener"></beans:bean>
	<beans:bean id="authenticationFailureHandler" class="devcken.springframework.security.web.authentication.AuthenticationFailureEventListener">
		<beans:property name="defaultFailureUrl" value="/security/login/failed"></beans:property>
	</beans:bean>
	
	<!-- 인증 매니저를 설정한다. -->
	<security:authentication-manager alias="authenticationManager">
		<security:authentication-provider ref="authenticationProvider">
		</security:authentication-provider>
	</security:authentication-manager>
	
	<!-- DAO Service Provider 클래스를 자동 감지한다. -->
	<context:component-scan base-package="com.foundationmade.newbiz.core.security.service" />
	
	<!-- UserDetailService 의 구현에 대한 Spring Bean 을 선언한다. -->
	<bean id="userDetailsService"
		class="com.foundationmade.newbiz.core.security.service.UserDetailsServiceImplement">
	</bean>
	
	<!-- DAO 인증에 사용될 문자열 Digester를 선언한다. -->
	<bean id="jasyptStringDigest"
		class="org.jasypt.digest.StandardStringDigester">
		<property name="algorithm" value="SHA-512"></property>
		<property name="iterations" value="1000"></property>
	</bean>
	
	<!-- DAO 인증 시 패스워드 크리덴셜 암호화를 위한 인코더를 선언한다. -->
	<bean id="passwordEncoder"
		class="org.jasypt.springsecurity3.authentication.encoding.PasswordEncoder">
		<property name="stringDigester" ref="jasyptStringDigest"></property>
	</bean>
	
	<!-- DAO 를 통한 인증 제공자를 설정한다. -->
	<bean id="authenticationProvider"
		class="org.springframework.security.authentication.dao.DaoAuthenticationProvider">
		<property name="userDetailsService" ref="userDetailsService"></property>
		<property name="passwordEncoder" ref="passwordEncoder"></property>
	</bean>
	
	<!-- 인증 처리 이벤트를 위한 리스너를 등록한다. -->
	<bean class="devcken.springframework.context.BroadcastableAuthenticationEventListener"></bean>
	
</beans>